<template>
	<view class="conversion">
		<commonHeader :title="$t('ll1')"></commonHeader>
		<view class="gHeadbox"></view>
		<view class="box">
			<view class="d_f_between boxBwe">
				<view class="boxBwe_Lbox" style="width:30%">
					<view class="boxBwe_Lbox_txt">
						<!-- {{ $t('ac2') }} -->
						{{ $t('ll14')}}
					</view>
					<view class="boxBwe_Lbox_lang">

					</view>
					<view class="boxBwe_Lbox_txt">
						<!-- {{ $t('ac3') }} -->
						<!-- USDT账户 -->
						{{ $t('ll15')}}
					</view>
				</view>
				<view class="boxBwe_Cbox">
					<view class="boxBwe_Cbox_t" >
						<view class="boxBwe_Cbox_t_c" >
							<image src="@/static/img/zha.png" mode=""></image>
							<text class="numname">JUMP</text>
						</view>
						<view class="knum">
							{{ $t('ac4') }}：{{Number(Number(maccount.dynamicJump).toFixed(6))}}
						</view>

					</view>
					<view class="boxBwe_Cbox_t boxBwe_Cbox_c">
						<view class="boxBwe_Cbox_t_c">
							
							<image src="@/static/img/zhb.png" mode=""></image>
							<text class="numname">USDT</text>
							<!-- <text class="yue">≈XX.XXUSDT</text> -->
						</view>
						<view class="knum">
							{{ $t('ll16')}}：{{Number(Number(maccount.usdt).toFixed(6))}}
						</view>

					</view>
				</view>
			<!-- 	<view class="boxBwe_Rbox">
					<image src="@/static/img/zhc.png" mode=""></image>
				</view> -->
			</view>

			<view class="box_lang"> </view>
			<view class="boxAddress_s">
				<view class="boxAddress_s_nadd">
					{{ $t('ac5') }}：
				</view>
				<view class="boxAddress_s_nadds">
					<input type="text" :placeholder="$t('ll17')+ Number(Number(pconfigicon.teamWithdrawNum).toFixed(6))"  v-model="num" />
					<text class="all" @click="quanbu">{{ $t('ll18')}}</text>
				</view>
				<view style="text-align: right;color:red;margin-top:20upx;font-size:24upx;">
					{{ $t('ll19')}}：  {{Number(Number(num*startPrice).toFixed(6))}}    USDT
				</view>
			</view>
			
		
			<view class="boxAddress" style="margin-top:20upx;">
				<view class="boxAddress_nadd">
					{{ $t('ac8') }}：
				</view>
				<view class="boxAddress_nadds">
					<input type="password" :placeholder="$t('ac9')" v-model="password" />
				</view>
			</view>
			<view class="prowerBox_rule">
				<view class="rule_title">
					<text class="langrule"></text>
					<text>{{$t('pp7')}}</text>
				</view>
				<view class="rule_item">
					<view>
						<text>{{ $t('ll20')}}</text>
					</view>
					<view>
						<text>{{ $t('ll21')}}</text>
					</view>
					<view>
						<text>{{ $t('ll22')}}</text>
					</view>
				</view>
				<view class="rule_bom">
			
				</view>
			</view>
			<view class="boxBtn" @click="queren">
				{{ $t('ll23')}}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		memberAccount, //用户资产
		quarterPlan,
		pconfig,
		zhuanhuan,
		homeIndex
	} from '@/api/home.js'
	export default {
		data() {
			return {
				typeCher: 1,
				maccount:null,
				startPrice:0,
				num:"",
				pconfigicon:null,
				password:""
			}
		},
		mounted() {
			this.fnmemberAccount()
			this.homeIndex()
			this.fnpconfig()
		},
		methods: {
			// 用户资产
			fnmemberAccount() {
				var params = {
					address: this.$store.state.devAddress
				}
				memberAccount(params).then(res => {
					console.log(res)
					if (res.code == 200) {
						this.maccount = res.data
					}
				})
			},
			// 首页信息
			homeIndex() {
				homeIndex().then(res => {
					console.log("res",res)
					if (res.code == 200) {
						this.startPrice = res.data.jumpPrice;
					}
				})
			},
			// 配置信息
			fnpconfig() {
				pconfig().then(res => {
					if (res.code == 200) {
						this.pconfigicon = res.data
					}
				})
			},
			quanbu(){
				this.num=Number(Number(this.maccount.dynamicJump).toFixed(6))
			},
			queren(){
				let tishi=""
				if(this.num==""){
					tishi="请输入兑换数量"
				}else if(this.password==""){
					tishi="请输入密码"
				}
				if(tishi!=""){
					uni.showToast({
						icon: 'error',
						title:tishi,
					})
					return
				}
				
				
				let data={
					amount:this.num,
					address:this.$store.state.devAddress,
					password:this.password
				}
				zhuanhuan(data).then(res => {
					if (res.code == 200) {
						uni.showToast({
							icon: 'success',
							title:this.$t("at14"),
						})
						this.fnmemberAccount()
						this.homeIndex()
						this.num=""
						this.password=""
					}else {
						uni.showToast({
							icon: 'error',
							title: res.msg,
						})
					}
				})
				
			}
		}
	}
</script>
<style>
	/deep/.uni-input {
		line-height: 60rpx !important;
	}
</style>
<style scoped lang="scss">
	.box {
		padding: 30rpx;
		box-sizing: border-box;
		.prowerBox_rule {
			padding: 10rpx 20rpx;
			box-sizing: border-box;
			margin-top:20upx;
		
			.rule_title {
				display: flex;
				align-items: center;
				justify-content: flex-start;
				color: rgb(214, 167, 249);
				font-size: 30rpx;
				font-weight: 500;
				font-family: "苹方";
				margin-bottom: 20rpx;
		
				.langrule {
					width: 4rpx;
					height: 30rpx;
					opacity: 1;
					border: 2rpx solid rgb(214, 167, 249);
					background: linear-gradient(-16.5deg, rgb(241, 184, 255) 0%, rgb(228, 116, 255) 100%);
					margin-right: 10rpx;
				}
			}
		
			.rule_item {
				color: rgb(182, 182, 182);
				font-size: 28rpx;
				font-family: "苹方";
		
				text {
					line-height: 50rpx;
				}
			}
		
			.rule_bom {
				width: 100%;
				height: 2rpx;
				backdrop-filter: blur(8px);
				background: linear-gradient(135deg, rgba(255, 255, 255, 0) 0%, #ffffff 50%, rgba(255, 255, 255, 0) 100%) border-box;
				text-align: center;
				margin: 38rpx auto 10rpx;
			}
		}

		.boxBwe {
			&_Lbox {
				color: #d6a7f9;
				font-size: 30rpx;
				font-weight: 500;
				display: flex;
				flex-wrap: wrap;
				align-items: center;
				justify-content: center;
				flex-direction: column;

				&_txt {
					margin: 16rpx 0;
				}

				&_lang {
					height: 70rpx;
					border-left: 2rpx dotted #d6a7f9;
				}
			}

			&_Cbox {
				&_t {
					width: 528rpx;
					height: 110rpx;
					padding: 30rpx;
					box-sizing: border-box;
					background: url("@/static/img/za.png") no-repeat;
					background-size: contain;
					position: relative;

					.knum {
						position: absolute;
						right: 30rpx;
						bottom: 6rpx;
						color: #eccdff;
						font-size: 16rpx;
						font-weight: 400;
					}

					&_c {
						display: flex;
						align-items: center;

						image {
							width: 54rpx;
							height: 54rpx;
							margin-right: 26rpx;
						}

						.numname {
							color: #ffffff;
							font-size: 42rpx;
							font-weight: 900;
							margin-right: 20rpx;
						}

						.yue {
							color: #ffffff;
							font-size: 18rpx;
							font-weight: 400;
						}
					}
				}

				&_c {
					background: url("@/static/img/zb.png") no-repeat;
					background-size: contain;
					margin-top: 50rpx;

					.numname {
						color: #d6a7f9;
					}
					
				}
			}

			&_Rbox {
				image {
					width: 68rpx;
					height: 68rpx;
				}
			}

		}

		.box_lang {
			width: 100%;
			height: 2rpx;
			opacity: 1;
			// background: #cc00ff3b;
			backdrop-filter: blur(8px);
			background: linear-gradient(190deg, #cc00ff3b 0%, #ffffff 40%, #ffffff 70%, #cc00ff3b 100%) border-box;
			text-align: center;
			margin: 22rpx auto;

		}

		.boxAddress_s {
			width: 100%;
			margin-top: 36rpx;
			padding: 30rpx;
			box-sizing: border-box;

			&_nadd {
				color: #d6a7f9;
				font-size: 30rpx;
				font-weight: 500;
				margin-bottom: 22rpx;
			}

			&_nadds {
				color: #ffffff;
				font-size: 28rpx;
				font-weight: 400;
				font-family: "苹方";
				border-bottom: 2rpx solid #b1b1b2;
				line-height: 60rpx;
				height: 60rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				input {
					line-height: 60rpx !important;
				}


				::placeholder {
					color: #b6b6b6;
					font-size: 28rpx;
					font-weight: 400;
					font-family: "苹方";
				}

				.all {
					color: #d6a7f9;
					font-size: 28rpx;
					font-weight: 900;
				}
			}
		}

		.boxAddress {
			width: 100%;
			border-radius: 24rpx;
			opacity: 1;
			border: 2rpx solid #979797;
			background: linear-gradient(137deg, #65008275 0%, #20005e63 100%);
			box-shadow: inset 0 2rpx 6rpx 0 #4545458a, inset 0 0 16rpx 0 #ffffff3b, 4rpx 4rpx 20rpx 0 #00000038;
			margin-top: 78rpx;
			padding: 30rpx;
			box-sizing: border-box;

			&_nadd {
				color: #ffffff;
				font-size: 28rpx;
				font-weight: 900;
				font-family: "苹方";
				margin-bottom: 22rpx;
			}

			&_nadds {
				color: #ffffff;
				font-size: 24rpx;
				font-weight: 400;
				font-family: "苹方";
				border-bottom: 2rpx solid #b1b1b2;
				line-height: 60rpx;
				height: 60rpx;

				input {
					line-height: 60rpx;
				}

				::placeholder {

					color: #aaaaac;
					font-size: 24rpx;
					font-weight: 400;
					font-family: "苹方";
				}
			}
		}

		.boxBtn {
			background: url("@/static/img/w.png") no-repeat;
			background-size: contain;
			width: 572rpx;
			height: 78rpx;
			line-height: 78rpx;
			text-align: center;
			color: #ffffff;
			font-size: 42rpx;
			font-weight: 500;
			margin: 10rpx auto;

		}
		
	}
</style>